package vip.george.sentinel1.config;

import com.alibaba.csp.sentinel.annotation.aspectj.SentinelResourceAspect;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author george
 * @since 2023/7/7
 * <p>Sentinel配置</p>
 */
@Configuration
public class SentinelConfig {


    /**
     * 如果接入sentinel接入的是传统web项目或springboot项目
     * 需要为@SentinelResource注解使用提供一个切面类的bean
     *
     * 如果是spring cloud 项目，则不需要配置切面bean
     * @return
     */
    @Bean
    public SentinelResourceAspect sentinelResourceAspect() {
        return new SentinelResourceAspect();
    }
}
